<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link type="text/css" rel="stylesheet" href="/static/jodit/jodit.min.css" />
    <script type="text/javascript" src="/static/jodit/jodit.min.js"></script>
</head>
<body>
    <div style="position: absolute; left: 10px; top: 10px; right: 10px; bottom: 10px;">
        <textarea id="editor" name="editor"></textarea>
    </div>
</body>
</html>
<script>
Jodit.make('#editor', {
    width: '100%',
    height: '100%',
    language: 'zh_cn',
    uploader: {
        url: "{:url('admin/editor/jodit')}?action=fileUpload",
        isSuccess: function(res) {
            for (var i = 0; i < res.data.files.length; i++) {
                if (res.data.files[i] === '') {
                    this.jodit.message.error(res.data.messages[i]);
                }
            }
            // this.jodit.s.insertHTML('<p><video src="http://wglj.jiaozuo.gov.cn/upfile/202209/2022091075089609.mp4" controls="controls">您的浏览器不支持 video 标签。</video></p>');
            return true;
        },
        // buildData: function (data) {
            // console.log(data.getAll('files[0]')[0].size > 1024 * 1024 * {:ini_get('upload_max_filesize')});
            // return new Promise(function() {});
        // },
        // getMessage: function (res) {
        // }
        // process: function (resp) {
        //     console.log(resp);
        //     return {
        //         files: resp.files || [],
        //         path: resp.path,
        //         baseurl: resp.baseurl,
        //         error: resp.error,
        //         msg: resp.msg
        //     };
        // },
    },
    beautifyHTML: false,
    sourceEditor: false,
});
</script>
